﻿
namespace Aocsoft
{
    public static class RuntimeInfo
    {
        private static string _currentApplicationBinPath = string.Empty;

        public static string GetCurrentApplicationBinPath()
        {
            return CurrentApplicationBinPath;
        }

        /// <summary>
        /// 当前应用程序执行的Bin目录
        /// </summary>
        public static string CurrentApplicationBinPath
        {
            get
            {
                if (string.IsNullOrWhiteSpace(_currentApplicationBinPath))
                {
                    _currentApplicationBinPath = System.Web.HttpContext.Current != null ?
                 System.AppDomain.CurrentDomain.SetupInformation.PrivateBinPath :
                 System.AppDomain.CurrentDomain.BaseDirectory;
                    _currentApplicationBinPath += _currentApplicationBinPath.EndsWith(@"\") ? string.Empty : @"\";
                }
                return _currentApplicationBinPath;
            }
        }
    }
}
